package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.Result;
import com.zmj.sy.mom.srv.aps.bean.vo.dicttype.*;
import com.zmj.sy.mom.srv.aps.service.DictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "字典类型管理")
@RestController
@RequestMapping("/dictType")
public class DictTypeController {

    private final DictTypeService dictTypeService;

    @PostMapping("/add")
    @ApiOperation("11.1.1-新增字典类型")
    public Result<String> add(@RequestBody DictTypeAddReqVo reqVo) {
        dictTypeService.add(reqVo);
        return Result.success("添加成功");
    }

    @PostMapping("/edit")
    @ApiOperation("11.1.2-编辑字典类型")
    public Result<String> edit(@RequestBody DictTypeEditReqVo reqVo) {
        dictTypeService.edit(reqVo);
        return Result.success();
    }

    @PostMapping("/delete")
    @ApiOperation("11.1.3-删除字典类型")
    public Result<String> delete(@RequestBody BaseIdReqVo reqVo) {
        dictTypeService.delete(reqVo);
        return Result.success("删除成功");
    }

    @GetMapping("/list")
    @ApiOperation("11.1.4-查询字典类型列表")
    public Result<DictTypeListResVo> list(DictTypeListReqVo reqVo) {
        return Result.success(dictTypeService.list(reqVo));
    }

    @GetMapping("/get")
    @ApiOperation("11.1.5-根据ID查询字典类型")
    public Result<DictTypeGetResVo> get(BaseIdReqVo reqVo) {
        return Result.success(dictTypeService.get(reqVo));
    }

}
